package practiceSelenium.pages;

import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import java.time.Duration;
import java.util.Set;
import java.util.concurrent.TimeUnit;

public class Wework {

    WebDriver driver;

    public Wework startBrowser() {
        driver = new ChromeDriver();
        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(15));
        return this;
    }

    public MainPage login() {
        try {
            driver.get("https://work.weixin.qq.com/wework_admin/frame#contacts");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public void getCookie() {
        try {
            driver.get("https://work.weixin.qq.com/wework_admin/frame#contacts");
            Set<Cookie> cookies = driver.manage().getCookies();
            System.out.println(cookies);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
